package com.example.check.service;

import com.example.check.mapper.PermissionMapper;
import com.example.check.entity.PermissionEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;

/**
 * Created by Tony Yao on 2017/7/17.
 */

@Service
public class PermissionServiceImpl implements PermissionService {
    @Autowired
    private PermissionMapper pdao;
    @Override
    public ArrayList<PermissionEntity> searchAllPermission() throws Exception {
        return pdao.selectAllPermission();
    }

    @Override
    public PermissionEntity searchPermissionByID(int id) throws Exception {
        return pdao.selectPermissionByID(id);
    }

    @Override
    public ArrayList<PermissionEntity> searchPermissionByField(String field, String code) throws Exception {
        return pdao.selectPermissionByField(field,code);
    }

    @Override
    public ArrayList<PermissionEntity> searchPermissionLikeByField(String field, String code) throws Exception {
        return pdao.selectPermissionLikeByField(field, code);
    }

    @Override
    public void deletePermissionById(int id) throws Exception {
        pdao.deletePermissionById(id);
        return ;
    }

    @Override
    public void insertPermission(PermissionEntity role) throws Exception {
        pdao.insertPermission(role);
        return ;
    }

    @Override
    public void editPermission(PermissionEntity role) throws Exception {
        pdao.editPermission(role);
        return ;
    }
}
